/*
 * All rights Reserved, Designed By www.goldbeacon.cn
 * @Title:  demo-springboot
 * @Package com.chenzhengrong.demospringboot.annotation
 * @author: chenzhengrong
 * @date:   2022/8/18 15:26
 * @version V1.0
 * Copyright © 2022 www.goldbeacon.cn. All Rights Reserved.
 * 注意：本内容仅限于湖南金烽信息科技有限公司内部传阅，禁止外泄以及用于其他的商业目
 */
package com.chenzhengrong.demospringboot.annotation;

import com.chenzhengrong.demospringboot.util.StringUtils;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.util.stream.Collectors;

/**
 * @author chenzhengrong
 * @title: InValidator
 * @description: 自定义校验
 * @date 2022/8/18 15:26
 */
public class InValidator implements ConstraintValidator<IsMobile, String> {


    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {

        if (StringUtils.isEmpty(value)) {
            return false;
        } else {
            return StringUtils.isMobile(value);
        }

    }
}
